package com.pbking.facebook.delegates.data
{
	import com.pbking.facebook.Facebook;
	import com.pbking.facebook.delegates.FacebookDelegate;

	/**
	 * delegate for calling data.getHashValue 
	 * reference: http://wiki.developers.facebook.com/index.php/Data_Store_API_documentation 
	 * 
	 * @author sol wu
	 */
	public class GetHashValueDelegate extends FacebookDelegate
	{
		/** property value retrieved */
		public var propValue:Object = null;
		
		/**
		 * @param obj_type 	Object's type. This is required, so that different object types may use the same hash keys for different objects.
		 * @param key 	Hash key (string object identifier) for locating the object. This is created by a call to Data.setHashValue.
		 * @param prop_name 	Name of the property to query. 
		 */ 
		public function GetHashValueDelegate(facebook:Facebook, objType:String, key:String, propName:String)
		{
			super(facebook);
			if (objType != "") { fbCall.setRequestArgument("obj_type", objType); }
			if (key != "") { fbCall.setRequestArgument("key", key); }
			if (propName != "") { fbCall.setRequestArgument("prop_name", propName); }
			fbCall.post("facebook.data.getHashValue");
		}
		
		override protected function handleResult(result:Object):void
		{
			// what if it failed?
			if (result) {
				propValue = result;
			}
		}
		
	}
}